//
//  FGMixPadTableViewController.m
//  VoiceWakeUp
//
//  Created by Feng on 2019/3/8.
//  Copyright © 2019 com.orvibo.com. All rights reserved.
//

#import "FGMixPadTableViewController.h"

@interface FGMixPadTableViewController ()

@end

@implementation FGMixPadTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.allMixPadArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    HMDevice *device = self.allMixPadArr[indexPath.row];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.textLabel.text = device.deviceName;
    if ([self.vc.mixpad.deviceId isEqualToString:device.deviceId]) {
        cell.backgroundColor = [UIColor blueColor];
    }else {
        cell.backgroundColor = [UIColor whiteColor];
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    HMDevice *device = self.allMixPadArr[indexPath.row];
    self.vc.mixpad = device;
    [self.tableView reloadData];
    [self.navigationController popViewControllerAnimated:YES];
}

@end
